package com.cx.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author: Zhou wei
 * @create: 2020/6/12 18:35
 */
public class AlipayConfig {

    // natapp内外网穿透地址
    public static final String natUrl = "http://ui9s3p.natappfree.cc";

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "2016102200740231";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCPub3vtmP4BRHBDjF/2+IuSJTtDFYVGwGa51QIhP0yIqFy5UPdxro+RHtHdYlKo5VtTVxRv6zEKwP1GNf8mzON21kEV0WFwPGdwuxVeutqFKeyfFhqUomLa7H15Sfs1N1CDZK6zCTDWBGLGeUibmV7wbOlyIN3YOBYBdDVqTYlKM3V3b7teJbZaSLr9tQC7ChvrcsvDLW+LNvbTIvyqIXWKiHPGRyXN0SDxGvccfGbkyGAQIREyelQxv5qKKl5GruTeWG81+ZoeyVooOhHBuzQAetne949WcCJRwjHaI25B3AtJCRYNPlIXVqtl9Lat8N5hOKQtZ8IIb/VwXhoiE+BAgMBAAECggEAfujHM3z9BwsK40pyIPF65d2HS02iUV6Yazyqsh8kJ/n2T6rr40/QMp1rseyyPyr1Dh/KThEPL+S/yNOYHGC7BB7UmoWpSPLXJrPw1YYFi5UTgwJTXAbnlymQaY1gVLqdaO7tSm5qY+dHDmneLyoGCGJBDDljBK2RS4hPH+sbeXEYnIqAXaPmpPGLzh7OJf2uZQn2PQVKSKQo5u1id4fSprfMXimOaIRs4MHFpRaXIRqWLkTrxFAbkt2YhVsujrFmnQswp/idndx71WdqejqleJPA5a7D9qXCsszVMy/SG4lwqRXc73Ww29pe7rlsY2t/LS59hd6n59nMIx+YpNuzAQKBgQDfj3wyy8/VrCI5YdF1BgUldVnETbBXl1InLYOFxynXd/ADnlVfmzo0sGKkTFE76NV3eaHlPu+GvtLFfaj1/jJeR/8CIcGfuohAyIwTtM0AaAYoM5t+NQvM1oQ8KuD3ICVsR7lMYW1eajeJx+8mIvD3Z5TzJT5Cu+Wf/JfTFAWY0QKBgQCklKjPgCwT64aDnfrCjO2lRkPtcG/bjZhCFI/QYIahPqcJGjwO51Wo3aEFK1ONJY+8NC4CWDqaVQG7G2++sMa6on2FJTSJXs+vfeJomNbaqC9R0tMVTdWXrltfBVwnfOMBWaQhq/G2qzl566/anqinv29lBkabZFmoW5hAFLj3sQKBgQCBX6G6K6Q8vP6ZQnhaRn+X689lAKh6KAHM1lP0iQs3vBrTnT8+sq/+aczL07Z2+wj9uQ/tgHxQ+AE1dMDgiphPY065xxsr+mB7TRNzHAA+qfRWM3dalAweIE4qG45QtPOzM9aR0xfduY4mV+OXqETWh8T06KqdJ+t8qEqcRkvu4QKBgBxG3mooX2pcwRPEBN2AUSRgWjNlahKS1WIlHkBzFS6HETPjKgZ1gKYuzgeRVh2eIn/3hyAoAImbqVx4bk6ZGMvgNyi1J72iaJSCUHAgMmoHE3o/erziTpxs/I3q4dZ3ApmsySJv5Gu6J3nnIKOzNs77eSwmU+NG7pCajCIWbWFBAoGBAI8ZpqwCVpSNLCaPtp7WkVCCfJsqBQQaxdrfNILYXsxiy7+YW534TLxl4kqKmCJm2v4d8Mb8LBkaQLTEMJT8FOoJpl7fpDizNkcbMKt1n5MvwwFCGW8PQb11y3u+Mfs/J3lVWebWiD9TfQEFDtOSwxvjeIfdHMS+UD/Q9NLI5r+z";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzARCBCS7ojrsipbqD6wF4J9aoIw35z/uZLyMp17TevIxYz80Rpu4AILE5URHdp0znsi+Mil6ZCOt2D5nxFoqaalSvafm59yfQNxMxxmYvhpklJSFqx8ef/P9Q7bQkr9JKtRThZki/cRRELFaiVyj9wuv6p7hsnWDcaOX8X6rdDOwhl78jtSypSwRGJTweZ0QPXUV1KYc0D8DYWz124QFrZ8F0Ceu18ow7WqTlzyPeizaAz4fcI3GFQpgs6ghatpUVq02TmPT5eCKBr13Mgsag2i5xp8ZkrJQ4pOEo9977yYGU3fK0J/4H3JjY2qwfYN+jhKu7NkUsCPG3FRh9jBEiQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = natUrl + "/pharmacy/alipay/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = natUrl + "/pharmacy/alipay/return";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String CHARSET = "utf-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "D:\\z支付宝沙箱日志";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
